package com.cluster;

import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-03-11.
 *
 * @author zhoufy
 */
public interface UserDao extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> {


    /**
     * 查询所有
     *
     * @return
     */
    @Query("from User")
    List<User> findByJpql();


    @Query("from User where username=:username and password=:password")
    User getUser(@Param("username")String username, @Param("password")String password);

    /**
     * 新增或更新
     *
     * @param resume
     * @return
     */
    @Override
    User save(User resume);


    /**
     * 删除数据
     *
     * @param resume
     */
    @Override
    void delete(User resume);
}
